package com.unicomcz.xh;

import java.sql.ResultSet;
import java.util.List;

import com.unicomcz.DetailPageAction;

public class XhAction extends DetailPageAction
{
    private String hm;
    private int minFee=0;
    private int maxFee=9999;
    private String teleType="3G";
    public XhAction() {
        setRowPerpage(80);
    }
    
    /**
     * @return the teleType
     */
    public String getTeleType()
    {
        return teleType;
    }

    /**
     * @param teleType the teleType to set
     */
    public void setTeleType(String teleType)
    {
        this.teleType = teleType;
    }

    /**
     * @return the hm
     */
    public String getHm()
    {
        return hm;
    }
    /**
     * @param hm the hm to set
     */
    public void setHm(String hm)
    {
        this.hm = hm;
    }
    /**
     * @return the minFee
     */
    public int getMinFee()
    {
        return minFee;
    }
    /**
     * @param minFee the minFee to set
     */
    public void setMinFee(int minFee)
    {
        this.minFee = minFee;
    }
    /**
     * @return the maxFee
     */
    public int getMaxFee()
    {
        return maxFee;
    }
    /**
     * @param maxFee the maxFee to set
     */
    public void setMaxFee(int maxFee)
    {
        this.maxFee = maxFee;
    }
    public String getSqlStr() {
        String departId = "";
        if (userInfo==null) {
            departId = "'53101'";
        }else {
            departId = "'"+userInfo.getUserId()+"','"+userInfo.getQx()+"'";
        }
        String sqlStr="SELECT serial_number,depart_id,price FROM dls_xh_number WHERE depart_id IN (" +departId+")"+ 
                " and price between "+Integer.toString(minFee)+" and "+Integer.toString(maxFee);
        if ((hm!=null)&&(hm.trim().compareTo("")!=0)) {
            sqlStr += " and serial_number like '%"+hm+"%' ";
        }
        if (teleType.trim().compareTo("3G")==0) {
            sqlStr += " and substr(serial_number,1,3)='186' ";
        }else {
            sqlStr += " and substr(serial_number,1,3)<>'186' ";
        }
        sqlStr +=" order by 3,1";
        //log.debug(sqlStr);
        return sqlStr;
    }
    public Object[] getParams() {
        return new Object[]{};
    }
    protected void regQueryParam() throws Exception{
    }
    
    protected void rs2List(ResultSet rs,List out) throws Exception{
         HmBean a = new HmBean();
         a.setSerialNumber(rs.getString(1));
         a.setPrice(Integer.toString(rs.getInt(3)));
         out.add(a);
    }
    
    /*gmku modify 2012-2-29 去除权限认定*/
    public boolean validatePriv() {
        return true;
    }

}
